################################################################################
## MOD Title:		easyUCP update 1.1.1 to 1.1.6
## MOD Author:		AmigaLink < webmaster@amigalink.de > (Markus Schmidt) http://www.EssenMitFreude.info
## 
## Installation Level:	Difficult
## Installation Time:	5- 10 Minutes 
##
## Files To Edit:  	5
##			includes/usercp_avatar.php
##			includes/usercp_register.php
##			includes\usercp_signature.php
##
##			templates\subSilver\profile_signature.tpl
##
##			language/lang_german/lang_main.php
##
## Included Files:	0
##
################################################################################
## The following sites also contain the latest version of this MOD: 
## 
## http://www.AmigaLink.de
## http://www.phpBBhacks.com
## http://www.phpBB.de
## 
## Full support for this MOD only can be obtained at: 
##
## http://www.AmigaLink.de
##  
################################################################################
## MOD History: 
##
##   2005-02-18 - Version 1.1.6 (unreleased)
##	- some bugfixes
##	- some little optical changes
##	- work with phpBB 2.0.11 and above
##
##   2004-09-11 - Version 1.1.1 plus
##	- phpBB plus 1.5x installation guide
##
##   2004-08-31 - Version 1.1.1
##	- Fixed a little bug in the lang_main.php part of the installation guide
##
##   2004-08-29 - Version 1.1.0
##	- First release
##	- User selectable Guests-Profileview-permission added
##
##   2004-08-28 - Version 1.0.3 rc
##	- one little bugfix by OXPUS
##	- one little stylefix by OXPUS
##
##   2004-08-25 - Version 1.0.0
##	- First Version
## 
################################################################################
##
##  This hack is released under the GPL License. 
##  This hack can be freely used, but not distributed, without permission.
##  Intellectual Property Rights are retained by the hack author(s) 
##  listed above.
##
################################################################################
##
##  BEFORE ADDING THIS HACK TO YOUR FORUM, please be sure to backup ALL
##  affected files.
##
################################################################################

# 
#-----[ OPEN ]------------------------------------------ 
# 

includes/usercp_avatar.php 

# 
#-----[ FIND ]------------------------------------------ 
# 

   global $board_config, $db, $template, $lang, $images, $theme; 

# 
#-----[ IN-LINE FIND ]---------------------------------- 
# 

, $theme 

# 
#-----[ IN-LINE AFTER, ADD ]---------------------------- 
# 

, $ucp_mode 

# 
#-----[ FIND ]------------------------------------------ 
# 

   $params = array('coppa', 'user_id', 'username', 'email', 'current_email', 'cur_password', 'new_password', 'password_confirm', 'icq', 'aim', 'msn', 'yim', 'website', 'location', 'occupation', 'interests', 'signature', 'viewemail', 'notifypm', 'popup_pm', 'notifyreply', 'attachsig', 'allowhtml', 'allowbbcode', 'allowsmilies', 'hideonline', 'style', 'language', 'timezone', 'dateformat'); 

# 
#-----[ IN-LINE FIND ]---------------------------------- 
# 

, 'dateformat' 

# 
#-----[ IN-LINE AFTER, ADD ]---------------------------- 
# 

, 'ucp_mode' 

# 
#----------[ OPEN ]------------------------------------- 
# 

includes/usercp_register.php 

# 
#----------[ FIND ]------------------------------------- 
# 

         if ( $ucp_mode !='require' ) 
         { 
            $s_hidden_fields .= '<input type="hidden" class="post" name="email" value="' . $userdata['user_email'] . '" />'; 

#
#----------[ REPLACE WITH ]-----------------------------
#

	if ( $ucp_mode !='ucp_require' )
	{
		$s_hidden_fields .= '<input type="hidden" class="post" name="email" value="' . $userdata['user_email'] . '" />';

		if ( $board_config['allow_namechange'] )
		{
			$s_hidden_fields .= '<input type="hidden" class="post" name="username" value="' . $username . '" />';
		}

# 
#----------[ FIND ]------------------------------------- 
# 

   // Visual Confirmation 
   $confirm_image = ''; 
   if (!empty($board_config['enable_confirm']) && $mode == 'register') 
   { 
      $sql = 'SELECT session_id 
         FROM ' . SESSIONS_TABLE; 
      if (!($result = $db->sql_query($sql))) 
      { 
         message_die(GENERAL_ERROR, 'Could not select session data', '', __LINE__, __FILE__, $sql); 
      } 

      if ($row = $db->sql_fetchrow($result)) 
      { 
         $confirm_sql = ''; 
         do 
         { 
            $confirm_sql .= (($confirm_sql != '') ? ', ' : '') . "'" . $row['session_id'] . "'"; 
         } 
         while ($row = $db->sql_fetchrow($result)); 
        
         $sql = 'DELETE FROM ' .  CONFIRM_TABLE . " 
            WHERE session_id NOT IN ($confirm_sql)"; 
         if (!$db->sql_query($sql)) 
         { 
            message_die(GENERAL_ERROR, 'Could not delete stale confirm data', '', __LINE__, __FILE__, $sql); 
         } 
      } 
      $db->sql_freeresult($result); 

      $sql = 'SELECT COUNT(session_id) AS attempts 
         FROM ' . CONFIRM_TABLE . " 
         WHERE session_id = '" . $userdata['session_id'] . "'"; 
      if (!($result = $db->sql_query($sql))) 
      { 
         message_die(GENERAL_ERROR, 'Could not obtain confirm code count', '', __LINE__, __FILE__, $sql); 
      } 

      if ($row = $db->sql_fetchrow($result)) 
      { 
         if ($row['attempts'] > 3) 
         { 
            message_die(GENERAL_MESSAGE, $lang['Too_many_registers']); 
         } 
      } 
      $db->sql_freeresult($result); 
        
      $confirm_chars = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',  'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',  'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9'); 

      list($usec, $sec) = explode(' ', microtime()); 
      mt_srand($sec * $usec); 

      $max_chars = count($confirm_chars) - 1; 
      $code = ''; 
      for ($i = 0; $i < 6; $i++) 
      { 
         $code .= $confirm_chars[mt_rand(0, $max_chars)]; 
      } 

      $confirm_id = md5(uniqid($user_ip)); 

      $sql = 'INSERT INTO ' . CONFIRM_TABLE . " (confirm_id, session_id, code) 
         VALUES ('$confirm_id', '". $userdata['session_id'] . "', '$code')"; 
      if (!$db->sql_query($sql)) 
      { 
         message_die(GENERAL_ERROR, 'Could not insert new confirm code information', '', __LINE__, __FILE__, $sql); 
      } 

      unset($code); 
        
      $confirm_image = (@extension_loaded('zlib')) ? '<img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id") . '" alt="" title="" />' : '<img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=1") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=2") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=3") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=4") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=5") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=6") . '" alt="" title="" />'; 
      $s_hidden_fields .= '<input type="hidden" name="confirm_id" value="' . $confirm_id . '" />'; 

      $template->assign_block_vars('switch_confirm', array()); 
   } 

# 
#----------[ REPLACE WITH ]----------------------------- 
# 

/* 
   // Visual Confirmation 
   $confirm_image = ''; 
   if (!empty($board_config['enable_confirm']) && $mode == 'register') 
   { 
      $sql = 'SELECT session_id 
         FROM ' . SESSIONS_TABLE; 
      if (!($result = $db->sql_query($sql))) 
      { 
         message_die(GENERAL_ERROR, 'Could not select session data', '', __LINE__, __FILE__, $sql); 
      } 

      if ($row = $db->sql_fetchrow($result)) 
      { 
         $confirm_sql = ''; 
         do 
         { 
            $confirm_sql .= (($confirm_sql != '') ? ', ' : '') . "'" . $row['session_id'] . "'"; 
         } 
         while ($row = $db->sql_fetchrow($result)); 
        
         $sql = 'DELETE FROM ' .  CONFIRM_TABLE . " 
            WHERE session_id NOT IN ($confirm_sql)"; 
         if (!$db->sql_query($sql)) 
         { 
            message_die(GENERAL_ERROR, 'Could not delete stale confirm data', '', __LINE__, __FILE__, $sql); 
         } 
      } 
      $db->sql_freeresult($result); 

      $sql = 'SELECT COUNT(session_id) AS attempts 
         FROM ' . CONFIRM_TABLE . " 
         WHERE session_id = '" . $userdata['session_id'] . "'"; 
      if (!($result = $db->sql_query($sql))) 
      { 
         message_die(GENERAL_ERROR, 'Could not obtain confirm code count', '', __LINE__, __FILE__, $sql); 
      } 

      if ($row = $db->sql_fetchrow($result)) 
      { 
         if ($row['attempts'] > 3) 
         { 
            message_die(GENERAL_MESSAGE, $lang['Too_many_registers']); 
         } 
      } 
      $db->sql_freeresult($result); 
        
      $confirm_chars = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',  'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',  'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9'); 

      list($usec, $sec) = explode(' ', microtime()); 
      mt_srand($sec * $usec); 

      $max_chars = count($confirm_chars) - 1; 
      $code = ''; 
      for ($i = 0; $i < 6; $i++) 
      { 
         $code .= $confirm_chars[mt_rand(0, $max_chars)]; 
      } 

      $confirm_id = md5(uniqid($user_ip)); 

      $sql = 'INSERT INTO ' . CONFIRM_TABLE . " (confirm_id, session_id, code) 
         VALUES ('$confirm_id', '". $userdata['session_id'] . "', '$code')"; 
      if (!$db->sql_query($sql)) 
      { 
         message_die(GENERAL_ERROR, 'Could not insert new confirm code information', '', __LINE__, __FILE__, $sql); 
      } 

      unset($code); 
        
      $confirm_image = (@extension_loaded('zlib')) ? '<img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id") . '" alt="" title="" />' : '<img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=1") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=2") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=3") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=4") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=5") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=6") . '" alt="" title="" />'; 
      $s_hidden_fields .= '<input type="hidden" name="confirm_id" value="' . $confirm_id . '" />'; 

      $template->assign_block_vars('switch_confirm', array()); 
   } 
*/ 

# 
#----------[ FIND ]------------------------------------- 
# 

   if ( $ucp_mode == 'ucp_require' || $ucp_mode == '' ) 
   { 
      $template->assign_block_vars('switch_ucp_require', array()); 
      if ( $mode == 'editprofile' ) 
      { 
         $template->assign_block_vars('switch_ucp_require.switch_edit_profile', array()); 
      } 

#
#----------[ BEFORE, ADD ]------------------------------
#

   if ( $ucp_mode ) 
   { 
      $template->assign_vars(array( 
         'UCP_NAV' => '&nbsp;&nbsp;<a href="' . append_sid("profile.$phpEx") . '" class="nav">' . $lang['Viewing_profile'] . '</a>&nbsp;&nbsp;' . $lang['Edit_profile']) 
      ); 
   }

#
#----------[ FIND ]-------------------------------------
#

      if ( ($mode == 'register') || ($board_config['allow_namechange']) ) 
      { 
         $template->assign_block_vars('switch_ucp_require.switch_namechange_allowed', array()); 
      } 
      else 
      { 
         $template->assign_block_vars('switch_ucp_require.switch_namechange_disallowed', array()); 
      } 

# 
#----------[ AFTER, ADD ]------------------------------- 
# 

         // Visual Confirmation 
         $confirm_image = ''; 
         if (!empty($board_config['enable_confirm']) && $mode == 'register') 
         { 
            $sql = 'SELECT session_id 
               FROM ' . SESSIONS_TABLE; 
            if (!($result = $db->sql_query($sql))) 
            { 
               message_die(GENERAL_ERROR, 'Could not select session data', '', __LINE__, __FILE__, $sql); 
            } 

            if ($row = $db->sql_fetchrow($result)) 
            { 
               $confirm_sql = ''; 
               do 
               { 
                  $confirm_sql .= (($confirm_sql != '') ? ', ' : '') . "'" . $row['session_id'] . "'"; 
               } 
               while ($row = $db->sql_fetchrow($result)); 
             
               $sql = 'DELETE FROM ' .  CONFIRM_TABLE . " 
                  WHERE session_id NOT IN ($confirm_sql)"; 
               if (!$db->sql_query($sql)) 
               { 
                  message_die(GENERAL_ERROR, 'Could not delete stale confirm data', '', __LINE__, __FILE__, $sql); 
               } 
            } 
            $db->sql_freeresult($result); 

            $sql = 'SELECT COUNT(session_id) AS attempts 
               FROM ' . CONFIRM_TABLE . " 
               WHERE session_id = '" . $userdata['session_id'] . "'"; 
            if (!($result = $db->sql_query($sql))) 
            { 
               message_die(GENERAL_ERROR, 'Could not obtain confirm code count', '', __LINE__, __FILE__, $sql); 
            } 

            if ($row = $db->sql_fetchrow($result)) 
            { 
               if ($row['attempts'] > 3) 
               { 
                  message_die(GENERAL_MESSAGE, $lang['Too_many_registers']); 
               } 
            } 
            $db->sql_freeresult($result); 
             
            $confirm_chars = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',  'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',  'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9'); 

            list($usec, $sec) = explode(' ', microtime()); 
            mt_srand($sec * $usec); 

            $max_chars = count($confirm_chars) - 1; 
            $code = ''; 
            for ($i = 0; $i < 6; $i++) 
            { 
               $code .= $confirm_chars[mt_rand(0, $max_chars)]; 
            } 

            $confirm_id = md5(uniqid($user_ip)); 

            $sql = 'INSERT INTO ' . CONFIRM_TABLE . " (confirm_id, session_id, code) 
               VALUES ('$confirm_id', '". $userdata['session_id'] . "', '$code')"; 
            if (!$db->sql_query($sql)) 
            { 
               message_die(GENERAL_ERROR, 'Could not insert new confirm code information', '', __LINE__, __FILE__, $sql); 
            } 

            unset($code); 
             
            $confirm_image = (@extension_loaded('zlib')) ? '<img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id") . '" alt="" title="" />' : '<img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=1") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=2") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=3") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=4") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=5") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=6") . '" alt="" title="" />'; 
            $s_hidden_fields .= '<input type="hidden" name="confirm_id" value="' . $confirm_id . '" />'; 

            $template->assign_block_vars('switch_ucp_require.switch_confirm', array()); 
         } 

# 
#----------[ OPEN ]------------------------------------- 
# 

\includes\usercp_signature.php 

# 
#----------[ FIND ]------------------------------------- 
# 

      'SAVE_MESSAGE' => $save_message, 

# 
#----------[ AFTER, ADD ]------------------------------- 
# 

// <!-- BEGIN easyUCP --> 
      'UCP_NAV' => '&nbsp;&nbsp;<a href="' . append_sid("profile.$phpEx") . '" class="nav">' . $lang['Viewing_profile'] . '</a>&nbsp;&nbsp;' . $lang['Edit_profile'], 
// <!-- END easyUCP --> 

# 
#----------[ OPEN ]------------------------------------- 
# 

\templates\subSilver\profile_signature.tpl 

# 
#----------[ FIND ]------------------------------------- 
# 

      <td align="left"><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a></span></td> 

# 
#----------[ INLINE FIND ]------------------------------ 
# 

{L_INDEX}</a> 

# 
#----------[ INLINE AFTER, ADD ]------------------------ 
# 

{UCP_NAV}

# 
#----------[ OPEN ]------------------------------------- 
# 

\language\lang_german\lang_main.php 

# 
#----------[ FIND ]------------------------------------- 
# 

$lang['Registration_info'] = 'Registrierungs-Informationen'; 

# 
#----------[ REPLACE WITH ]----------------------------- 
# 

$lang['Registration_info'] = 'Registrierungs-Daten'; 

# 
#----------[ OPEN ]------------------------------------- 
# 

\templates\subSilver\profile_add_body.tpl 

# 
#----------[ FIND ]------------------------------------- 
# 

      <td align="left"><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a></span></td> 

# 
#----------[ INLINE FIND ]------------------------------ 
# 

{L_INDEX}</a> 

# 
#----------[ INLINE AFTER, ADD ]------------------------ 
# 

{UCP_NAV} 

# 
#----------[ SAVE AND CLOSE ALL FILES ]----------------- 
# 
#     EoM
